﻿using System;
using System.Collections.Generic;
using UFIDA.U9.Base.PropertyTypes;
using UFIDA.U9.CBO.Pub.Controller;
using UFIDA.U9.CBO.SCM.PropertyTypes;
using UFIDA.U9.ISV.PUB.RestSV;
using UFIDA.U9.ISV.PUB.RestSV.Common;
using UFIDA.U9.ISV.PUB.RestSV.Model.Pub;
using UFIDA.U9.ISV.SM;

namespace JGSoft.U9CRTAPIEX.DTOs.RequestDTOs
{
	// Token: 0x0200001D RID: 29
	public class ShipLineRData
	{
		/// <summary>
		/// ID (该属性可为空,且无默认值)
		/// </summary>

		public long ID { get; set; }

		/// <summary>
		/// 单据行号 (该属性可为空,且无默认值)
		/// </summary>

		public int DocLineNo { get; set; }

		/// <summary>
		/// 料品信息 (该属性不可为空,且无默认值)
		/// </summary>

		public ItemInfoRData ItemInfo { get; set; }

		/// <summary>
		/// 最终价 (该属性不可为空,且无默认值)
		/// </summary>

		public decimal FinallyPriceTC { get; set; }

		/// <summary>
		/// 销售数量 (该属性不可为空,且无默认值)
		/// </summary>

		public decimal ShipQtyTUAmount { get; set; }

		/// <summary>
		/// 存储地点ID (该属性可为空,且无默认值)
		/// </summary>

		public long WhKey { get; set; }

		/// <summary>
		/// 存储地点Code (该属性可为空,且无默认值)
		/// </summary>

		public string WhCode { get; set; }

		/// <summary>
		/// 番号
		/// </summary>

		public long Seiban { get; set; }

		/// <summary>
		///             番号code (该属性可为空,且无默认值)
		/// </summary>

		public string SeibanCode { get; set; }

		/// <summary>
		/// 删除标志 (该属性可为空,但有默认值)
		/// </summary>

		public bool DeleteFlag { get; set; }

		/// <summary>
		/// 变化字段清单 (该属性可为空,但有默认值)
		/// </summary>

		public List<string> ChangeFieldList { get; set; }

		/// <summary>
		/// 批号(该属性可为空,且无默认值)
		/// </summary>

		public UFIDA.U9.ISV.PUB.RestSV.CommonArchiveDataDTOData Lot { get; set; }

		/// <summary>
		/// 免费品类型 (无默认值请传-1;赠品请传0；备损品请传1)
		/// </summary>

		public string FreeType { get; set; }

		/// <summary>
		/// 库位List
		/// </summary>

		public List<LocationR2Data> Locations { get; set; }

		/// <summary>
		/// 描述性弹性域 (该属性可为空,且无默认值)
		/// </summary>

		public DescFlexFieldRData DescFlexField { get; set; }

		/// <summary>
		/// 税组合编码
		/// </summary>

		public string TaxScheduleCode { get; set; }

		/// <summary>
		/// 项目编码(该属性可为空,且无默认值)
		/// </summary>

		public string ProjectCode { get; set; }

		/// <summary>
		/// 立账条件Code(该属性可为空,且无默认值)
		/// </summary>

		public string ConfirmTermCode { get; set; }
		/// <summary>
		/// 供应商Code(该属性可为空,且无默认值)
		/// </summary>

		public string SupplierCode { get; set; }

		// Token: 0x0600029A RID: 666 RVA: 0x00004D1C File Offset: 0x00002F1C
		public ShipLineDTOForIndustryChainData ToISVData()
		{
			ShipLineDTOForIndustryChainData data = new ShipLineDTOForIndustryChainData();
			data.DocLineNo = this.DocLineNo;
			data.ShipQtyTUAmount = this.ShipQtyTUAmount;
			data.FinallyPriceTC = this.FinallyPriceTC;
			data.ID = this.ID;
			data.DeleteFlag = this.DeleteFlag;
			bool flag = this.ItemInfo != null;
			if (flag)
			{
				data.ItemInfo = ToolUtils.ToItemInfoData(this.ItemInfo);
			}
			bool flag2 = !string.IsNullOrEmpty(this.WhCode) || this.WhKey > 0L;
			if (flag2)
			{
				data.WH = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData(this.WhKey, this.WhCode, "");
			}
			data.Seiban = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData();
			bool flag3 = this.Seiban > 0L;
			if (flag3)
			{
				data.Seiban.ID = this.Seiban;
			}
			bool flag4 = !string.IsNullOrEmpty(this.SeibanCode);
			if (flag4)
			{
				data.Seiban.Code = this.SeibanCode;
			}
			data.ChangeFieldList = this.ChangeFieldList;
			bool flag5 = this.DescFlexField != null;
			if (flag5)
			{
				data.DescFlexField = ToolUtils.ConvertDescFlexFieldToData(this.DescFlexField);
			}
			bool flag6 = this.Lot != null;
			if (flag6)
			{
				data.LotInfo = new LotInfoData();
				bool flag7 = this.Lot.ID > 0L;
				if (flag7)
				{
					data.LotInfo.LotMaster = new BizEntityKeyData();
					data.LotInfo.LotMaster.EntityID = this.Lot.ID;
				}
				data.LotInfo.LotCode = this.Lot.Code;
			}
			bool flag8 = !string.IsNullOrEmpty(this.FreeType);
			if (flag8)
			{
				int donationType;
				bool result = int.TryParse(this.FreeType, out donationType);
				bool flag9 = result;
				if (flag9)
				{
					data.DonationType = donationType;
				}
			}
			bool flag10 = this.Locations != null && this.Locations.Count > 0;
			if (flag10)
			{
				data.ShipLineLocations = new List<ShipLineLocationDTOForIndustryChainData>();
				foreach (LocationR2Data item in this.Locations)
				{
					ShipLineLocationDTOForIndustryChainData location = new ShipLineLocationDTOForIndustryChainData();
					location.Location = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData();
					location.Location.ID = item.LocationID;
					location.Location.Code = item.LocationCode;
					location.LocationNo = item.LocationNo;
					location.LocationQtyInvAmount = item.LocationQtyInvAmount;
					location.DealItemTime = item.DealItemTime;
					data.ShipLineLocations.Add(location);
				}
			}
			bool flag11 = !string.IsNullOrEmpty(this.TaxScheduleCode);
			if (flag11)
			{
				data.TaxSchedule = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData(-1L, this.TaxScheduleCode, "");
			}
			bool flag12 = !string.IsNullOrEmpty(this.ProjectCode);
			if (flag12)
			{
				data.Project = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData(-1L, this.ProjectCode, "");
			}
			data.ConfirmTerm = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData(-1L, this.ConfirmTermCode, "");
			bool flag13 = !string.IsNullOrEmpty(this.SupplierCode);
			if (flag13)
			{
				data.Supplier = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTOData(-1L, this.SupplierCode, "");
			}
			return data;
		}

		// Token: 0x0600029B RID: 667 RVA: 0x00005078 File Offset: 0x00003278
		public void FromISVData(ShipLineDTOForIndustryChainQueryData data)
		{
			this.DocLineNo = data.DocLineNo;
			this.ShipQtyTUAmount = data.ShipQtyTUAmount;
			this.FinallyPriceTC = data.FinallyPriceTC;
			this.ID = data.ID;
			bool flag = data.ItemInfo != null;
			if (flag)
			{
				this.ItemInfo = ToolUtils.FromItemInfoData(data.ItemInfo);
			}
			bool flag2 = data.WH != null;
			if (flag2)
			{
				this.WhKey = data.WH.ID;
				this.WhCode = data.WH.Code;
			}
			bool flag3 = data.DescFlexField != null;
			if (flag3)
			{
				this.DescFlexField = ToolUtils.ConvertDataToDescFlexField(data.DescFlexField);
			}
			bool flag4 = data.LotInfo != null;
			if (flag4)
			{
				this.Lot = new UFIDA.U9.ISV.PUB.RestSV.CommonArchiveDataDTOData
				{
					ID = data.LotInfo.ID,
					Code = data.LotInfo.Code
				};
			}
		}
	}
}
